#include "utils/read_file.h"

namespace monitor
{
    bool ReadFile::ReadLine(std::vector<std::string> *args)
    {
        std::string line;
        std::getline(ifs_, line); // 得到:0.19 0.27 0.18 1/294 43980
        if (ifs_.eof() || line.empty())
        {
            return false;
        }

        // istringstream 自动按照空格分隔
        std::istringstream line_ss(line);
        while (!line_ss.eof())
        {
            std::string word;
            line_ss >> word;
            args->push_back(word);
        }
        return true;
    }

} // namespace monitor